package com.fansaikj.erp.domain;

/*
 * Copyright © 2020-2035 erupt.xyz All rights reserved.
 * Author: YuePeng (erupts@126.com)
 */

import javax.persistence.*;

import com.fansaikj.erp.domain.comtactCompany.CustomerCompany;
import lombok.Data;
import lombok.EqualsAndHashCode;
import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.jpa.model.BaseModel;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Erupt(name = "账户流水")
@Table(name = "erp_account_flow")
@Entity
@Data
public class AccountFlow extends BaseModel {

    @EruptField(
            views = @View(
                    title = "主键ID", show = false
            ),
            edit = @Edit(
                    title = "主键ID",
                    type = EditType.INPUT, show = false, notNull = true,
                    inputType = @InputType
            )
    )
    private Long id;

    @EruptField(
            views = @View(
                    title = "结算单位",
                    column = "name"
            ),
            edit = @Edit(
                    title = "结算单位",
                    type = EditType.REFERENCE_TABLE, search = @Search,
                    referenceTableType = @ReferenceTableType(id = "id", label = "name")
            )
    )
    @ManyToOne
    private SettlementCompany settlementCompany;

    @EruptField(
            views = @View(
                    title = "往来单位",
                    column = "name"
            ),
            edit = @Edit(
                    title = "往来单位",
                    type = EditType.REFERENCE_TABLE, search = @Search,
                    referenceTableType = @ReferenceTableType(id = "id", label = "name")
            )
    )
    @ManyToOne
    private CustomerCompany contactCompany;

    @EruptField(
            views = @View(
                    title = "往来日期"
            ),
            edit = @Edit(
                    title = "往来日期",
                    type = EditType.DATE, search = @Search(vague = true),
                    dateType = @DateType(type = DateType.Type.DATE)
            )
    )
    private Date contactDate;

    @EruptField(
            views = @View(
                    title = "收支账户"
            ),
            edit = @Edit(
                    title = "收支账户",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String paymentAccount;

    @EruptField(
            views = @View(
                    title = "往来款摘要"
            ),
            edit = @Edit(
                    title = "往来款摘要",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(value = "1", label = "货款"),
                                    @VL(value = "2", label = "采购款"),
                                    @VL(value = "3", label = "客户退余额"),
                                    @VL(value = "4", label = "供应商退余额"),
                                    @VL(value = "5", label = "进票账"),
                                    @VL(value = "6", label = "出票账"),
                                    @VL(value = "7", label = "借法人款"),
                                    @VL(value = "8", label = "还法人款"),
                                    @VL(value = "9", label = "法人借款"),
                            }
                    )
            )
    )
    private String amountDesc;

    @EruptField(
            views = @View(
                    title = "收支方向"
            ),
            edit = @Edit(
                    title = "收支方向",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(value = "1", label = "收入"),
                                    @VL(value = "2", label = "支出")
                            }
                    )
            )
    )
    private String paymentDirection;

    @EruptField(
            views = @View(
                    title = "收入金额"
            ),
            edit = @Edit(
                    title = "收入金额",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String reciveAmount;

    @EruptField(
            views = @View(
                    title = "支出金额"
            ),
            edit = @Edit(
                    title = "支出金额",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String paymentAmount;

    @EruptField(
            views = @View(
                    title = "往来类型"
            ),
            edit = @Edit(
                    title = "往来类型",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String paymentType;

    @EruptField(
            views = @View(
                    title = "往来款编号"
            ),
            edit = @Edit(
                    title = "往来款编号",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String paymentNo;

    @EruptField(
            views = @View(
                    title = "创建人", show = false
            ),
            edit = @Edit(
                    title = "创建人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String createBy;

    @EruptField(
            views = @View(
                    title = "创建时间", show = false
            ),
            edit = @Edit(
                    title = "创建时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date createTime;

    @EruptField(
            views = @View(
                    title = "修改人", show = false
            ),
            edit = @Edit(
                    title = "修改人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String updateBy;

    @EruptField(
            views = @View(
                    title = "修改时间", show = false
            ),
            edit = @Edit(
                    title = "修改时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date updateTime;

    @EruptField(
            views = @View(
                    title = "备注"
            ),
            edit = @Edit(
                    title = "备注",
                    type = EditType.TEXTAREA
            )
    )
    private String remark;

    @EruptField(
            views = @View(
                    title = "删除状态(0-正常,1-已删除)", show = false
            ),
            edit = @Edit(
                    title = "删除状态(0-正常,1-已删除)",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String delFlag;

}
